﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SGDemo.Web
{
    public class PageBase : System.Web.UI.Page
    {
        public string PageKeyid
        {
            get { return this.Request.Cookies["PageKeyid"].Value; }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (!this.IsPostBack)
            {
                string PageKeyid = Guid.NewGuid().ToString();
                Response.Cookies.Remove("PageKeyid");
                HttpCookie cookie = new HttpCookie("PageKeyid");
                cookie.Value = PageKeyid;
                Response.Cookies.Add(cookie);
            }
        }
    }
}